/**
*	流程模块： 数据选项option的扩展js
*	开发者：雨中磐石
*	地址：www.rockoa.com
*	日期：2023-07-20
*/



js.option_list = function(){
	
	var me = this;
	var pidss = '0';
	
	this.initbodys = function(){
		this.otype = '';
		if(this.params.otype)this.otype = this.params.otype;
		this.settable({
			fanye:false,
			sort:'sort',dir:'asc',
			urlparams:{pid:'0',otype:this.otype},
			onitemdblclick:function(d){
				me.openpid(d.id);
			}
		});
		this.optobj.showleft('数据选项');
		var key = 'zhankai'+js.getrand()+'';
		window[key] = function(id1){me.openpid(id1);}
		this.setcolumns('temp_down', {
			renderer:function(v,d){
				var str = '';
				if(v>0)str = v;
				return '<button type="button" onclick="'+key+'('+d.id+')" class="webbtn webbtn-mini webbtn-default">展开'+str+'</button>';
			}
		});
	}
	
	this.onloadbefore = function(d){
		if(d.optionarr){
			importjs('tree','create', {
				data:d.optionarr,
				view:this.optobj.leftcontid(),
				firstid:d.firstid,
				active:false,
				openchliren:true,
				onitemclick:function(d){
					me.openpid(d.id);
				}
			});
		}
	}
	
	this.openpid = function(pid){
		pidss = pid;
		this.table.setparams({pid:pid}, true);
	}
	
	this.onaddbefore = function(){
		return {
			data:{'pid':pidss}
		};
	}

}